﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using KingRoad.EPM.PersonnelLogEntity.Model;
using Unis.Framework.Core.Utility;
using KingRoad.EPM.PersonnelLogDAL.SafeProductionService;


namespace KingRoad.EPM.PersonnelLogBLL.UIRules
{
    /// <summary> 
    /// 客户端业务处理类。 
    /// 文件生成时间 2017/1/19 10:55:12
    /// </summary> 
    public class ScmSafeproductionUIRule
    {
        private readonly IScmSafeproductionService _scmSafeproductionService;
        
        
        public ScmSafeproductionUIRule(){}
        
        /// <summary> 
        /// construct function... 
        /// </summary> 
        public ScmSafeproductionUIRule(IScmSafeproductionService  scmSafeproductionService)
        {
           _scmSafeproductionService=scmSafeproductionService;
        }

        /// <summary>
        /// 获取安全生产台账信息
        /// </summary>
        /// <returns></returns>
        public List<ScmSafeProductionInfo> GetAllSafeproduction()
        {
            var list = _scmSafeproductionService.GetEntityList();
            return list;
        }
        /// <summary>
        /// 根据条件查询安全生产台账信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmSafeProductionInfo> GetAllSafeProductionForPage(int numCurrentPage,int numPerPage,string orderByField,out int totalRecord,string sqlCondition)
        {
            var list = _scmSafeproductionService.GetEntityListByContionRe(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }
        /// <summary>
        /// 获取安全生产台账信息 根据ID获取
        /// </summary>
        /// <returns></returns>
        public ScmSafeProductionInfo GetSafeproductionByID(Guid id)
        {
            var list = _scmSafeproductionService.GetEntityById(id);
            return list;
        }

        /// <summary>
        /// 添加安全生产台账信息
        /// </summary>
        /// <returns></returns>
        public int AddSafeproduction(ScmSafeProductionInfo AddEntity)
        {
            return _scmSafeproductionService.InsertEntity(AddEntity);          
        }

        /// <summary>
        /// 删除安全生产台账信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteSafeproduction(string id)
        {
            return _scmSafeproductionService.DeleteEntityByStringID(id);
        }

        /// <summary>
        /// 删除安全生产台账信息(批量删除)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteSafeproductionMulti(string id)
        {
            return _scmSafeproductionService.DeleteEntityByMultiStringID(id);
        }

        /// <summary>
        /// 更新安全生产台账信息
        /// </summary>
        /// <returns></returns>
        public int UpdateSafeproduction(ScmSafeProductionInfo UpdateEntity)
        {
            return _scmSafeproductionService.UpdateEntity(UpdateEntity);
        }

        /// <summary>
        /// 获取所有的安全知识信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <returns></returns>
        public List<ScmSafeProductionInfo> GetAllSafeProduction(int numCurrentPage, int numPerPage, string orderByField, out int totalRecord)
        {
            var list = _scmSafeproductionService.GetEntityListByContion(numCurrentPage, numPerPage, orderByField, out totalRecord);
            return list;
        }

        /// <summary>
        /// 根据条件查询安全知识信息
        /// </summary>
        /// <param name="numCurrentPage">当前页</param>
        /// <param name="numPerPage">每页数据大小</param>
        /// <param name="orderByField">排序字段名称</param>
        /// <param name="totalRecord">总数据量</param>
        /// <param name="sqlCondition">sql查询条件</param>
        /// <returns></returns>
        public List<ScmSafeProductionInfo> GetSafeProductionForSearch(int numCurrentPage, int numPerPage,
                                                                        string orderByField, out int totalRecord, string sqlCondition)
        {
            var list = _scmSafeproductionService.GetEntityListByContion(numCurrentPage, numPerPage, orderByField, out totalRecord, sqlCondition);
            return list;
        }
    }
}

